#define FIR_ORDERS 192
float hnInterp[FIR_ORDERS] =
{
 -0.0005083577081638,-1.597756731663e-05,-1.359116681933e-05,-9.333958403228e-06,
  -3.105122666345e-06,5.209000459226e-06, 1.57368040385e-05,2.861500849848e-05,
  4.399193507873e-05,6.202463736053e-05,8.287631417312e-05,0.0001067175902796,
  0.0001337237066507,0.0001640741596086,0.0001979517050488, 0.000235541036185,
  0.0002770281087667,0.0003225989303641,0.0003724386809838,0.0004267307014302,
  0.0004856554968641, 0.000549389781412,0.0006181054787987,0.0006919687551488,
   0.000771139053344,0.0008557681143847,0.0009459990468419,  0.00104196535891,
   0.001143790061943, 0.001251584735752, 0.001365448671922, 0.001485467991329,
   0.001611714838641, 0.001744246568541, 0.001883105005862, 0.002028315715718,
	0.00217988734485, 0.002337810990025, 0.002502059636127, 0.002672587636329,
   0.002849330261661, 0.003032203305352, 0.003221102757273, 0.003415904543446,
   0.003616464336983, 0.003822617442047, 0.004034178750779, 0.004250942779008,
   0.004472683776236, 0.004699155918131, 0.004930093574028, 0.005165211658738,
   0.005404206059245, 0.005646754145705, 0.005892515356148, 0.006141131863745,
   0.006392229315431, 0.006645417649675, 0.006900291982024,  0.00715643356481,
   0.007413410809783, 0.007670780378441, 0.007928088329197, 0.008184871324441,
	0.00844065788715, 0.008694969708384, 0.008947322995948,  0.00919722986389,
   0.009444199753804, 0.009687740886055, 0.009927361732616,  0.01016257250826,
	0.01039288667251,  0.01061782243791,  0.01083690427773,  0.01104966442775,
	0.01125564437587,  0.01145439633359,  0.01164548468354,  0.01182848739697,
	0.01200299741577,  0.01216862399281,  0.01232499398581,  0.01247175309845,
	0.01260856706466,  0.01273512276998,  0.01285112930644,   0.0129563189555,
	0.01305044809584,  0.01313329803131,  0.01320467573634,  0.01326441451497,
	0.01331237457124,  0.01334844348809,  0.01337253661314,   0.0133845973493,
	 0.0133845973493,  0.01337253661314,  0.01334844348809,  0.01331237457124,
	0.01326441451497,  0.01320467573634,  0.01313329803131,  0.01305044809584,
	 0.0129563189555,  0.01285112930644,  0.01273512276998,  0.01260856706466,
	0.01247175309845,  0.01232499398581,  0.01216862399281,  0.01200299741577,
	0.01182848739697,  0.01164548468354,  0.01145439633359,  0.01125564437587,
	0.01104966442775,  0.01083690427773,  0.01061782243791,  0.01039288667251,
	0.01016257250826, 0.009927361732616, 0.009687740886055, 0.009444199753804,
	0.00919722986389, 0.008947322995948, 0.008694969708384,  0.00844065788715,
   0.008184871324441, 0.007928088329197, 0.007670780378441, 0.007413410809783,
	0.00715643356481, 0.006900291982024, 0.006645417649675, 0.006392229315431,
   0.006141131863745, 0.005892515356148, 0.005646754145705, 0.005404206059245,
   0.005165211658738, 0.004930093574028, 0.004699155918131, 0.004472683776236,
   0.004250942779008, 0.004034178750779, 0.003822617442047, 0.003616464336983,
   0.003415904543446, 0.003221102757273, 0.003032203305352, 0.002849330261661,
   0.002672587636329, 0.002502059636127, 0.002337810990025,  0.00217988734485,
   0.002028315715718, 0.001883105005862, 0.001744246568541, 0.001611714838641,
   0.001485467991329, 0.001365448671922, 0.001251584735752, 0.001143790061943,
	0.00104196535891,0.0009459990468419,0.0008557681143847, 0.000771139053344,
  0.0006919687551488,0.0006181054787987, 0.000549389781412,0.0004856554968641,
  0.0004267307014302,0.0003724386809838,0.0003225989303641,0.0002770281087667,
   0.000235541036185,0.0001979517050488,0.0001640741596086,0.0001337237066507,
  0.0001067175902796,8.287631417312e-05,6.202463736053e-05,4.399193507873e-05,
  2.861500849848e-05, 1.57368040385e-05,5.209000459226e-06,-3.105122666345e-06,
  -9.333958403228e-06,-1.359116681933e-05,-1.597756731663e-05,-0.0005083577081638
};
//float hnInterp[FIR_ORDERS] =
//{
//0.0006059466396, 0.0002386694105, 0.0002838757064, 0.0003343150602, 0.0003914033587,
//0.0004539804941, 0.0005224086344, 0.0005978445988, 0.0006792786298, 0.000767425634,
//0.0008634800906, 0.000965078827, 0.001075562788, 0.00119425857, 0.001319989562,
//0.001454578363, 0.001599373179, 0.001753382385, 0.001914801775, 0.002085100859,
//0.00226648245, 0.002456284361, 0.002655489603, 0.002864300041, 0.0030809124,
//0.003307272214, 0.003545481246, 0.003792665899, 0.004044238012, 0.004308428615,
//0.004583804868, 0.004863602109, 0.005151896738, 0.00544811273, 0.00575325964,
//0.006064762827, 0.006379592232, 0.006704657339, 0.007033498958, 0.007365976926,
//0.007707640063, 0.008049769327, 0.008394274861, 0.008746181615, 0.009098658338,
//0.009452268481, 0.009804815054, 0.01015921496, 0.01051191892, 0.01086158957,
//0.01120738126, 0.01155060902, 0.01188838761, 0.0122222323, 0.012551249,
//0.01287485287, 0.01318784524, 0.01349215955, 0.01379159559, 0.01408113539,
//0.01435556915, 0.01461754087, 0.01486883499, 0.01510769408, 0.01533261873,
//0.01554011833, 0.01573270001, 0.01591312699, 0.01607879624, 0.01622608863,
//0.01635240577, 0.01646162942, 0.01655447297, 0.01662922092, 0.01668235287,
//0.01671457849, 0.01673132367, 0.01672989503, 0.01670411415, 0.01665856875,
//0.01659850962, 0.01651728153, 0.01641212776, 0.01628790796, 0.01614942774,
//0.01599170454, 0.0158099588, 0.01561153773, 0.01539948396, 0.01516901236,
//0.0149209816, 0.01465597749, 0.01437829062, 0.01408515405, 0.01377602387,
//0.01345479395, 0.01312273927, 0.01277740393, 0.01242001913, 0.0120546231,
//0.01168094948, 0.01129639056, 0.01090546325, 0.01050916594, 0.01010883879,
//0.009700051509, 0.009286147542, 0.008875174448, 0.008463172242, 0.008045641705,
//0.007627890911, 0.007215654012, 0.006807159632, 0.006396424025, 0.005989346653,
//0.005591547582, 0.005197861698, 0.004806320183, 0.004423196893, 0.00405030977,
//0.003685185453, 0.003326998791, 0.002977351425, 0.002641210798, 0.002317156876,
//0.002002560999, 0.001695617801, 0.001399923116, 0.001119042747, 0.0008505455917,
//0.0005938487593, 0.0003480242158, 0.0001157172301, -9.937232971e-05, -0.0003014522372,
//-0.0004948819987, -0.0006752225454, -0.0008396639605, -0.0009926210623, -0.001134074875,
//-0.00126435142, -0.001381320413, -0.001487281988, -0.001580371754, -0.001660849201,
//-0.001729523297, -0.00178957521, -0.001837732038, -0.001875793794, -0.001902843476,
//-0.001925581368, -0.00193891034, -0.001940590097, -0.001939248526, -0.001929359976,
//-0.001910888706, -0.001890353975, -0.001860894146, -0.001825443353, -0.001786685782,
//-0.001743781613, -0.001697467058, -0.001643703436, -0.001589393127, -0.001536414726,
//-0.001476747799, -0.00141506514, -0.00135460333, -0.001293665031, -0.001230575144,
//-0.001167412032, -0.001104318071, -0.001040623523, -0.0009793771897, -0.0009187943651,
//-0.0008577035042, -0.0007982300012, -0.0007418017485, -0.0006875098334, -0.0006338700769,
//-0.0005823859829, -0.0005341385258, -0.0004861107154, -0.0004409656103, -0.0003978628374,
//-0.0003563841747, -0.0003178578336, -0.0002814518521, -0.0002470848558, -0.0002162375022,
//-0.0001878168987, -0.0005843833787
//};
float  fir_buff[FIR_ORDERS] = {0};
void firFilter(float *src, float *dst, float *coff)
{
	//static bool first = true;
	if (!src || !dst || !coff)
		return;

	for (size_t i = 0; i < FIR_ORDERS; i++)
	{
		for (size_t k = 0; k < FIR_ORDERS - 1; k++)
		{
			fir_buff[k] = fir_buff[k + 1];
		}
		fir_buff[FIR_ORDERS - 1] = src[i];

		/*if (first)
			continue;*/
		for (size_t j = 0; j< FIR_ORDERS; j++)
		{
			dst[i] += coff[j] * fir_buff[FIR_ORDERS -j-1];
		}
	}
	/*if (first)
	{
		memset(dst, 0, sizeof(dst));
		first = false;
	}*/
}